package org.dolphin.entity.district;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Embeddable
public class Address implements Serializable {
  private static final long serialVersionUID = 8988826646637717248L;
  private String street;
  private String postalCode;
  private City city;

  @ManyToOne(optional = false, fetch = FetchType.EAGER)
  @JoinColumn(name = "CITY", nullable = false)
  public City getCity() {
    return city;
  }

  @Column(name = "POSTAL_CODE", nullable = true, length = 50)
  public String getPostalCode() {
    return postalCode;
  }

  @Column(name = "STREET", nullable = false, length = 500)
  public String getStreet() {
    return street;
  }

  public void setCity(City city) {
    this.city = city;
  }

  public void setPostalCode(String postalCode) {
    this.postalCode = postalCode;
  }

  public void setStreet(String street) {
    this.street = street;
  }
}
